package com.chen.cotroller;

import com.chen.entity.Users;
import com.chen.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Title:
 * @Description: to do
 * @Author: chenjiwei
 * @Date: 2020-10-04 23:10
 * @Version: 1.0.0
 */
@RestController
@ComponentScan(value="com.chen")
@RequestMapping("/user")
public class UserController {
    private final Logger log = LoggerFactory.getLogger(UserController.class);

    @Value("${server.port}")
    private String port;

    @Autowired
    private UserService userServiceImpl;

    @RequestMapping("/addUser")
    public String addUser(Users users){
        userServiceImpl.addUser(users);
        log.info(port);
        log.info(users.toString());
        return "success";
    }
    public static void main(String[] args) {
        System.out.println("hello word!");
    }
}
